package paravyan;

import java.util.Arrays;
import java.util.Random;


public class Demo {

	public static void main(String[] args) {

		System.out.println("Quicksort:");
		final int LENGTH = 20;
		int[] array = new int[LENGTH];
		Random r = new Random();
		for (int i = 0; i < array.length; ++i) {
			array[i] = r.nextInt(100);
		}
		System.out.println(Arrays.toString(array));
		QuickSort.quickSort(array, 0, array.length - 1);
		System.out.println(Arrays.toString(array));

		System.out.println("BinarysearchTree:");
		BinarySearchTree<Integer> bst = new BinarySearchTree<Integer>();
		try {
			bst.insert(3);
			bst.insert(8);
			bst.insert(2);
			bst.insert(9);
			bst.insert(10);
			bst.insert(1);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println(bst.infixTraverse());
		System.out.println(bst.prefixTraverse());

		bst.remove(3);
		System.out.println(bst.infixTraverse());
		System.out.println(bst.prefixTraverse());

		System.out.println(bst.exists(2));
		System.out.println(bst.exists(11));

		System.out.println(bst.find(8).prefixTraverse());

	}

}
